home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / ODF Release 3 / ODFDev / ODF / OS / FWGraphx / FWGConst.cpp < prev    next >
Encoding:
Text File  |  1996-12-16  |  5.6 KB  |  165 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWGConst.cpp
  4. //    Release Version:    $ ODF 3 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "FWOS.hpp"
  11.  
  12. #ifndef FWGCONST_H
  13. #include "FWGConst.h"
  14. #endif
  15.  
  16. #ifndef FWSTRING_H
  17. #include "FWString.h"
  18. #endif
  19.  
  20. #ifndef FWCOLOR_H
  21. #include "FWColor.h"
  22. #endif
  23.  
  24. #ifndef FWINK_H
  25. #include "FWInk.h"
  26. #endif
  27.  
  28. #ifndef FWSTYLE_H
  29. #include "FWStyle.h"
  30. #endif
  31.  
  32. #ifndef FWFONT_H
  33. #include "FWFont.h"
  34. #endif
  35.  
  36. //========================================================================================
  37. //    RunTime Info
  38. //========================================================================================
  39.  
  40. #ifdef FW_BUILD_MAC
  41. #pragma segment FWGraphics_Constants
  42. #endif
  43.  
  44. //========================================================================================
  45. //    Constants
  46. //========================================================================================
  47.  
  48. // ----- Standard Colors -----
  49.  
  50. // I only define colors that are common
  51.  
  52. #define FW_RGB(r, g, b)    (((unsigned long)(r)) | ((unsigned long)(g) << 8) | ((unsigned long)(b) << 16))
  53.  
  54. #ifdef FW_BUILD_WIN 
  55. const FW_SColor    FW_kRGBBlack        =    {    FW_RGB(0x00, 0x00, 0x00)    };
  56. const FW_SColor    FW_kRGBWhite        =    {    FW_RGB(0xFF, 0xFF, 0xFF)    };
  57. const FW_SColor    FW_kRGBRed            =    {    FW_RGB(0xFF, 0x00, 0x00)    };
  58. const FW_SColor    FW_kRGBYellow        =    {    FW_RGB(0xFF, 0xFF, 0x00)    };
  59. const FW_SColor    FW_kRGBBlue            =    {    FW_RGB(0x00, 0x00, 0xC0)    };
  60. const FW_SColor    FW_kRGBGreen        =    {    FW_RGB(0x00, 0xFF, 0x00)    };
  61. const FW_SColor    FW_kRGBBrown        =    {    FW_RGB(0x80, 0x80, 0x00)    };
  62. const FW_SColor    FW_kRGBPurple        =    {    FW_RGB(0xFF, 0x00, 0xFF)    };
  63. const FW_SColor    FW_kRGBLightBlue    =    {    FW_RGB(0x00, 0x00, 0xFF)    };
  64. const FW_SColor    FW_kRGBGray            =    {    FW_RGB(0x80, 0x80, 0x80)    };
  65. const FW_SColor    FW_kRGBLightGray    =    {    FW_RGB(0xC0, 0xC0, 0xC0)    };
  66. const FW_SColor    FW_kRGBDarkGray        =    {    FW_RGB(0x40, 0x40, 0x40)    };
  67. #endif
  68.  
  69. #ifdef FW_BUILD_MAC
  70. const FW_SColor FW_kRGBBlack        =    {    FW_RGB(0x00, 0x00, 0x00)    };
  71. const FW_SColor FW_kRGBWhite        =    {    FW_RGB(0xFF, 0xFF, 0xFF)    };
  72. const FW_SColor FW_kRGBRed            =    {    FW_RGB(0xDD, 0x00, 0x00)    };
  73. const FW_SColor FW_kRGBYellow        =    {    FW_RGB(0xFF, 0xFF, 0x00)    };
  74. const FW_SColor FW_kRGBBlue            =    {    FW_RGB(0x00, 0x00, 0xDD)    };
  75. const FW_SColor FW_kRGBGreen        =    {    FW_RGB(0x00, 0xEE, 0x00)    };
  76. const FW_SColor FW_kRGBBrown        =    {    FW_RGB(0x99, 0x66, 0x00)    };
  77. const FW_SColor FW_kRGBPurple        =    {    FW_RGB(0x66, 0x00, 0x99)    };
  78. const FW_SColor FW_kRGBLightBlue    =    {    FW_RGB(0x00, 0x99, 0xFF)    };
  79. const FW_SColor FW_kRGBGray            =    {    FW_RGB(0x80, 0x80, 0x80)    };
  80. const FW_SColor FW_kRGBLightGray    =    {    FW_RGB(0xC0, 0xC0, 0xC0)    };
  81. const FW_SColor FW_kRGBDarkGray        =    {    FW_RGB(0x40, 0x40, 0x40)    };
  82. #endif
  83.  
  84. // ----- Standard patterns -----
  85.  
  86. // [HLX] should be moved to resource
  87.  
  88. const FW_BitPattern FW_kBlackPat = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};            // black
  89. const FW_BitPattern FW_kWhitePat = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};            // White
  90. const FW_BitPattern FW_kGrayPat = {0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55};                // Gray
  91. const FW_BitPattern FW_kLightGrayPat = {0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22};        // LightGray
  92. const FW_BitPattern FW_kDarkGrayPat = {0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD};            // DarkGray
  93. const FW_BitPattern FW_kHorizontalPat = {0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00};        // Horizontal
  94. const FW_BitPattern FW_kVerticalPat = {0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11};            // Vertical
  95. const FW_BitPattern FW_kFDiagonalPat = {0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11};        // FDiagonal
  96. const FW_BitPattern FW_kBDiagonalPat = {0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88};        // DDiagonal
  97. const FW_BitPattern FW_kCrossPat = {0x88, 0x88, 0x88, 0xFF, 0x88, 0x88, 0x88, 0xFF};            // Cross
  98. const FW_BitPattern FW_kDiagCrossPat = {0x88, 0x55, 0x22, 0x55, 0x88, 0x55, 0x22, 0x55};        // DiagCross
  99. const FW_BitPattern FW_kAntPat = {0xEE, 0x77, 0xBB, 0xDD, 0xEE, 0x77, 0xBB, 0xDD};                // Ant
  100.  
  101.  
  102. // ------ Standard font names -----
  103. #ifdef FW_BUILD_MAC
  104. static FW_CString FW_kPrivSystemFontName("systemFont");
  105. static FW_CString FW_kPrivDefaultFontName("applFont");
  106. static FW_CString FW_kPrivHelveticaFontName("Helvetica");
  107. static FW_CString FW_kPrivTimesFontName("Times");
  108. static FW_CString FW_kPrivCourierFontName("Courier");
  109. static FW_CString FW_kPrivPalatinoFontName("Palatino");
  110. #endif
  111.  
  112. #ifdef FW_BUILD_WIN
  113. static FW_CString FW_kPrivSystemFontName("System");
  114. static FW_CString FW_kPrivDefaultFontName("System");
  115. static FW_CString FW_kPrivHelveticaFontName("Arial");
  116. static FW_CString FW_kPrivTimesFontName("Times New Roman");
  117. static FW_CString FW_kPrivCourierFontName("Courier New");
  118. static FW_CString FW_kPrivPalatinoFontName("Palatino");
  119. #endif
  120.  
  121.  
  122. const FW_CString& FW_GetSystemFontName()
  123. {
  124.     return FW_kPrivSystemFontName;
  125. }
  126.  
  127. const FW_CString& FW_GetDefaultFontName()
  128. {
  129.     return FW_kPrivDefaultFontName;
  130. }
  131.  
  132. const FW_CString& FW_GetHelveticaFontName()
  133. {
  134.     return FW_kPrivHelveticaFontName;
  135. }
  136.  
  137. const FW_CString& FW_GetTimesFontName()
  138. {
  139.     return FW_kPrivTimesFontName;
  140. }
  141.  
  142. const FW_CString& FW_GetCourierFontName()
  143. {
  144.     return FW_kPrivCourierFontName;
  145. }
  146.  
  147. const FW_CString& FW_GetPalatinoFontName()
  148. {
  149.     return FW_kPrivPalatinoFontName;
  150. }
  151.  
  152. #ifdef FW_BUILD_MAC
  153. const FW_CString FW_MacGetFontName(short macFontID)
  154. {
  155.     Str255 pstr;
  156.     ::GetFontName(macFontID, pstr);                    // Get the font's name
  157.     FW_Locale locale;
  158.     locale.fScriptCode = ::FontToScript(macFontID);    // Get the font's locale
  159.     locale.fLangCode = ::GetScriptVariable(locale.fScriptCode, smScriptLang);
  160.     FW_CString fontName("", locale);
  161.     fontName.ReplaceAll(pstr);
  162.     return fontName;
  163. }
  164. #endif
  165.